import 'package:color_dart/RgbaColor.dart';
import 'package:flutter/material.dart';
import 'package:im_flutter_sdk_example/pages/expert/widgets/main_title.dart';

class AchievementRate extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        MainTitle(title: '项目进度'),
        Stack(children: [
          Container(
              color: Colors.white,
              child: Padding(
                padding: const EdgeInsets.all(20),
                child: Column(
                  children: [
                    AchievementRateItem(
                      data: '2019-02-03',
                      content: '国家空间中心高精度磁场探测技术成果转化及孵化项目。',
                    ),
                    AchievementRateItem(
                      data: '2019-05-03',
                      content:
                          '国家空间中心高精度磁场探测技术成果转化及孵化项目，国家空间中心高精度磁场探测技术成果转化及孵化项目。',
                    ),
                    AchievementRateItem(
                      data: '2019-08-03',
                      content: '国家空间中心高精度磁场探测技术成果转化。',
                    ),
                    AchievementRateItem(
                      data: '2019-12-03',
                      content:
                          '国家空间中心高精度磁场探测技术成果转化及孵化项目，国家空间中心高精度磁场探测技术成果转化及孵化项目。国家空间中心高精度磁场探测技术成果转化及孵化项目，国家空间中心高精度磁场探测技术成果转化及孵化项目。',
                    ),
                    AchievementRateItem(
                      data: '2020-01-03',
                      content: '国家空间中心高精度磁场探测技术成果转化。',
                    ),
                  ],
                ),
              )),
          // Positioned(
          //   left: 27,
          //   top: 20,
          //   bottom: 12,
          //   child: Container(
          //     decoration: new BoxDecoration(
          //       border:
          //           new Border.all(color: rgba(214, 232, 255, 1), width: .5),
          //       color: rgba(214, 232, 255, 1),
          //     ),
          //   ),
          // ),
        ]),
      ],
    );
  }
}

class AchievementRateItem extends StatelessWidget {
  final String data;
  final String content;

  const AchievementRateItem({Key key, this.data, this.content})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Positioned(
            child: Image.asset('lib/assets/images/dash_line.png'),
            top: 10,
            left: 8,
            bottom: 0),
        Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Container(
              width: 16,
              height: 16,
              child: Stack(
                children: [
                  Positioned(
                    left: 0,
                    top: 0,
                    bottom: 0,
                    right: 0,
                    child: Container(
                      decoration: new BoxDecoration(
                          border: new Border.all(
                              color: rgba(214, 232, 255, 1), width: 0.5),
                          color: rgba(214, 232, 255, 1),
                          borderRadius: new BorderRadius.circular((20.0))),
                    ),
                  ),
                  Positioned(
                    left: 4,
                    top: 4,
                    bottom: 4,
                    right: 4,
                    child: Container(
                      decoration: new BoxDecoration(
                          border: new Border.all(
                              color: rgba(42, 125, 250, 1), width: 0.5),
                          color: rgba(42, 125, 250, 1),
                          borderRadius: new BorderRadius.circular((20.0))),
                    ),
                  ),
                ],
              ),
            ),
            Expanded(
              child: Padding(
                padding: const EdgeInsets.only(left: 13),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      '$data',
                      style: TextStyle(
                          color: rgba(136, 135, 135, 1), fontSize: 13),
                    ),
                    Padding(
                      padding: const EdgeInsets.fromLTRB(0, 8, 0, 19),
                      child: Text(
                        '$content',
                        textAlign: TextAlign.left,
                        maxLines: 3,
                        overflow: TextOverflow.ellipsis,
                        style: TextStyle(
                          color: rgba(51, 51, 51, 1),
                          fontSize: 14,
                        ),
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ),
      ],
    );
  }
}
